package com.xgry.bpm.api.base.createtable.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author adrian
 * @since 2020-07-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("create_table")
public class CreateTable extends Model<CreateTable> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "tableId", type = IdType.AUTO)
    private Integer tableId;

    private String field;

    @TableField("notKey")
    private String notKey;

    @TableField("notNull")
    private String notNull;

    @TableField("tableName")
    private String tableName;

    private String type;

    @TableField("tableClassId")
    private Integer tableClassId;

    @TableField("fieldCh")
    private String fieldCh;

    private String state;

    @TableField("fileTypeCh")
    private String fileTypeCh;


    @Override
    protected Serializable pkVal() {
        return this.tableId;
    }

    public void setFileTypeCh(String fileTypeCh) {
        String result = "";
        switch (fileTypeCh){
            case "int":result = "整数";break;
            case "varchar(8000)":result = "短文本";break;
            case "text":result = "长文本";break;
            case "datetime":result = "日期";break;
            case "numeric(18,5)":result = "数值";break;
        }
        this.fileTypeCh = fileTypeCh;
    }
}
